<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
	String path = request.getContextPath();
%>
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
  <meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="icon" href="<%=path%>/images/favicon.ico" type="image/ico">
<meta name="author" content="guowenjie">
<link href="<%=path%>/css/bootstrap.min.css" rel="stylesheet">
<link href="<%=path%>/css/materialdesignicons.min.css" rel="stylesheet">
<link href="<%=path%>/css/style.min.css" rel="stylesheet">
<link rel="stylesheet" href="<%=path%>/js/ion-rangeslider/ion.rangeSlider.min.css">
<link href="<%=path%>/js/jconfirm/jquery-confirm.min.css" rel="stylesheet">
<link href="<%=path%>/js/bootstrap-datepicker/bootstrap-datepicker3.min.css" rel="stylesheet">
<link href="<%=path%>/js/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
<link href="<%=path%>/css/materialdesignicons.min.css" rel="stylesheet">
<link rel="stylesheet" href="<%=path%>/style/layui/css/layui.css">

<script type="text/javascript" src="<%=path%>/js/jquery.min.js"></script>
 <script type="text/javascript" src="<%=path%>/js/main.min.js"></script>
<script src="<%=path%>/js/bootstrap-datepicker/bootstrap-datepicker.min.js"></script>
<script src="<%=path%>/js/bootstrap-datepicker/locales/bootstrap-datepicker.zh-CN.min.js"></script>
<script type="text/javascript" src="<%=path%>/js/bootstrap.min.js"></script>
<script type="text/javascript" src="<%=path%>/js/bootstrap-table/bootstrap-table.js"></script>
<script type="text/javascript" src="<%=path%>/js/bootstrap-table/bootstrap-table-zh-CN.min.js"></script>
<script type="text/javascript" src="<%=path%>/js/jconfirm/jquery-confirm.min.js"></script>
<script type="text/javascript" src="<%=path%>/style/layui/layui.js"></script>

</head>
 <div class="container-fluid p-t-15">
    
        <div  class="card">
      <div class="card-body">
        <div class="row">
        
          <div class="col-md-12">
           <table id="table" ></table>
        </div>
        
            
        </div>
        
      </div></div></div>
      
  
      
   
      
       <script type="text/javascript">
  

       
       $('#table').bootstrapTable({
    	   classes: 'table table-condensed table-hover',
    		data:[],
    		 dataType : 'json',        // 因为本示例中是跨域的调用,所以涉及到ajax都采用jsonp,
    	    pagination: true,                    // 是否显示分页
    	    search: true,                    // 是否显示分页
     	    pageNumber: 1,                       // 初始化加载第一页，默认第一页
    	    pageSize: 10,                        // 每页的记录行数
    	    sidePagination: "client",            // 分页方式：client客户端分页，server服务端分页
    	    columns: [{
    	        field: 'DName',
    	        title: '分类'
    	     },{
    	        field: 'Sjmc',
    	        title: '上级名称'
    	     },{
    	        field: 'Mname',
    	        title: '决策树名称'
    	     },{
    	        field: 'operate',
    	        title: '操作',
    	        formatter: btnGroup,  // 自定义方法
    	        events: {
    	            'click .edit-btn': function (event, value, row, index) {
    	            	
    	            	window.location = "<%=path%>/bg/jcsglmx?Mname="+row.Mname +"&DMid="+row.DMid;
    	            	
    	            	
    	            }
    	        }
    	    }],
    	 
    	    onLoadSuccess: function(data){
    	        $("[data-toggle='tooltip']").tooltip();
    	    }
    	});

    	search();
    	function search(){
    	$.ajax({
    		 type: "post",//方法类型
    	   dataType: "json",//预期服务器返回的数据类型 jsonp跨域
    		url: "<%=path%>/bg/getjcsdata",
    		success: function(req) {	
    			let data = req.data;
    			$("#table").bootstrapTable('refreshOptions',{data:data});	 
    		},error: function(e){ 
    			console.log(e);
    			
    		}
    	});
    	}



    	// 操作按钮
    	function btnGroup ()
    	{
    	    let html =
    	        '<a href="#!" class="btn btn-xs btn-default m-r-5 edit-btn" title="编辑" data-toggle="tooltip"><i class="mdi mdi-pencil"></i></a>';
    	    return html;
    	}
    	
    	
       
      </script>
       </body>

</html>   